#include <math.h>
#include<stdio.h>
#include<graphics.h>

void draw_RouteTable_up(double center_x, double center_y, double side);
void draw_RouteTable_down(double center_x, double center_y, double side);
void draw_RouteTable_bigScrew2(double screw_x, double screw_y, double screw_r, double angle);
void draw_RouteTable_bigScrew(double screw_x, double screw_y, double screw_r, double angle);
void draw_RouteTable_smallScrew(double screw_x, double screw_y, double screw_r, double angle);
void draw_RouteTable_Side_Button(double center_x, double center_y, double side);
void draw_RouteTable_down1(double center_x, double center_y, double side);
void draw_RouteTable_down1_button(double center_x, double center_y, double side);
void draw_RouteTable_down2(double center_x, double center_y, double side);
void draw_RouteTable_down2_circle(double center_x, double center_y, double side);
void draw_RouteTable_down2_square(double center_x, double center_y, double side);
void draw_RouteTable_down2_square_poly(double center_x, double center_y, double side);


void draw_FMC(double center_x, double center_y, double side) {
	
	//side是宽，中心点的坐标是对于下半部分而言的
	draw_RouteTable_up(center_x,center_y - side*1.055, side);

	draw_RouteTable_down(center_x, center_y, side);
}


// 上半部分的表
void draw_RouteTable_up(double center_x, double center_y, double side) {//side传的是竖高
	//参数设定
	double single = side / 67;
	double length = single * 92;//横长
	double width = single * 67;// 竖宽

	ege_enable_aa(false);// 关闭抗锯齿
	setcolor(EGEARGB(0xff, 0x1b, 0x20, 0x25));//接下来画外框1的线条
	setlinewidth(4);
	ege_point points1[5] = {
		center_x - length / 2,center_y - width / 2,//左上
		center_x - length / 2,center_y + width / 2,//左下
		center_x + length / 2,center_y + width / 2,//右下
		center_x + length / 2,center_y - width / 2,//右上
		center_x - length / 2,center_y - width / 2//左上
	};
	ege_drawpoly(5, points1);

	setcolor(EGEARGB(0xff, 0x1b, 0x20, 0x25));//接下来画外框2的线条
	setlinewidth(4);
	ege_point points2[22] = {

		center_x - single * 33,center_y - single * 28.5,//1

		//加入曲线拟合点——左上角弧线点
		center_x - single * 35.9,center_y - single * 27.5,
		center_x - single * 36.5,center_y - single * 26,
		center_x - single * 37,center_y - single * 25,

		center_x - single * 38,center_y - single * 24.5,//2
		center_x - single * 38,center_y + single * 26.5,//3

		//加入曲线拟合点——左下角弧线点
		center_x - single * 36,center_y + single * 27.5,
		center_x - single * 35.5,center_y + single * 28.5,
		center_x - single * 35.4,center_y + single * 29,

		center_x - single * 33,center_y + single * 30.5,//4
		center_x + single * 33,center_y + single * 30.5,//5

		//加入曲线拟合点——右下角弧线点
		center_x + single * 35,center_y + single * 30.5,
		center_x + single * 36,center_y + single * 28.5,
		center_x + single * 37.5,center_y + single * 27,

		center_x + single * 38,center_y + single * 26.5,//6
		center_x + single * 38,center_y - single * 24.5,//7

		//加入曲线拟合点——右上角弧线点
		center_x + single * 37.6,center_y - single * 25.6,
		center_x + single * 36.5,center_y - single * 27,
		center_x + single * 33.4,center_y - single * 28,

		center_x + single * 33,center_y - single * 28.5,//8
		center_x - single * 33,center_y - single * 28.5,//1
		center_x - single * 33,center_y - single * 28.5//1
	};
	ege_bezier(22, points2);

	setfillcolor(EGEARGB(0XFF, 0X1A, 0X1F, 0X23));
	floodfill(center_x - single * 33, center_y - single * 30.5, EGEARGB(0xff, 0x1b, 0x20, 0x25));//1定位点向上的点
	floodfill(center_x - single * 42, center_y - single * 24.5, EGEARGB(0xff, 0x1b, 0x20, 0x25));//2定位点向左的点
	floodfill(center_x - single * 42, center_y + single * 26.5, EGEARGB(0xff, 0x1b, 0x20, 0x25));//3定位点向左的点
	floodfill(center_x + single * 42, center_y + single * 26.5, EGEARGB(0xff, 0x1b, 0x20, 0x25));//6定位点向右的点
	floodfill(center_x + single * 42, center_y - single * 24.5, EGEARGB(0xff, 0x1b, 0x20, 0x25));//7定位点向右的点
	floodfill(center_x + single * 33, center_y - single * 30.5, EGEARGB(0xff, 0x1b, 0x20, 0x25));//8定位点向上的点


	setcolor(EGEARGB(0xff, 0x1b, 0x20, 0x25));//接下来画外框3的线条
	setlinewidth(4);
	ege_point points3[22] = {

		center_x - single * 27,center_y - single * 24.5,//1

		//加入曲线拟合点——左上角弧线点
		center_x - single * 29.5,center_y - single * 24.5,
		center_x - single * 30.5,center_y - single * 23,
		center_x - single * 31.5,center_y - single * 22,

		center_x - single * 32,center_y - single * 21.5,//2
		center_x - single * 32,center_y + single * 23.5,//3

		//加入曲线拟合点——左下角弧线点
		center_x - single * 30.5,center_y + single * 24,
		center_x - single * 29.5,center_y + single * 25.5,
		center_x - single * 28,center_y + single * 26,

		center_x - single * 27,center_y + single * 26.5,//4
		center_x + single * 27,center_y + single * 26.5,//5

		//加入曲线拟合点——右下角弧线点
		center_x + single * 28,center_y + single * 26,
		center_x + single * 29.5,center_y + single * 25,
		center_x + single * 31,center_y + single * 24,

		center_x + single * 32,center_y + single * 23.5,//6
		center_x + single * 32,center_y - single * 21.5,//7

		//加入曲线拟合点——右上角弧线点
		center_x + single * 31.5,center_y - single * 22.6,
		center_x + single * 29,center_y - single * 23.8,
		center_x + single * 27.2,center_y - single * 24,

		center_x + single * 27,center_y - single * 24.5,//8
		center_x - single * 27,center_y - single * 24.5,//1
		center_x - single * 27,center_y - single * 24.5//1

	};
	ege_bezier(22, points3);

	setfillcolor(EGEARGB(0XFF, 0X15, 0X1A, 0X1D));
	floodfill(center_x - single * 26, center_y - single * 26.5,EGEARGB(0xff, 0x1b, 0x20, 0x25));//1定位点向上的点
	//floodfill(center_x - single * 34.5, center_y - single * 21.5, EGEARGB(0xff, 0x1b, 0x20, 0x25));//2定位点向左的点
	//floodfill(center_x - single * 31, center_y + single * 21.5, EGEARGB(0xff, 0x1b, 0x20, 0x25));//3定位点向左的点
	floodfill(center_x - single * 26, center_y + single * 28.5, EGEARGB(0xff, 0x1b, 0x20, 0x25));//4定位点向下的点
	floodfill(center_x + single * 26, center_y + single * 28.5, EGEARGB(0xff, 0x1b, 0x20, 0x25));//5定位点向下的点
	//floodfill(center_x + single * 34.5, center_y + single * 23.5, EGEARGB(0xff, 0x1b, 0x20, 0x25));//6定位点向右的点
	//floodfill(center_x + single * 34.5, center_y - single * 23.5, EGEARGB(0xff, 0x1b, 0x20, 0x25));//7定位点向右的点
	floodfill(center_x + single * 26, center_y - single * 26.5,EGEARGB(0xff, 0x1b, 0x20, 0x25));//8定位点向上的点

	ege_enable_aa(true);
	setlinewidth(6);
	setcolor(EGEARGB(0xff, 0x1b, 0x20, 0x25));//接下来画外框1的线条
	ege_bezier(22, points2);
	setcolor(EGEARGB(0XFF, 0X15, 0X1A, 0X1D));
	ege_bezier(22, points3);

	// 左上角小螺丝
	draw_RouteTable_smallScrew(center_x - single * 43 ,center_y - single *31 , side / 46.1538461538, 0);
	// 左上角大螺丝
	draw_RouteTable_bigScrew(center_x - single * 43.5, center_y - single * 25, side / 30, 90);
	// 左下角小螺丝
	draw_RouteTable_smallScrew(center_x - single * 43, center_y + single * 31, side / 46.1538461538, 0);
	// 右上角小螺丝
	draw_RouteTable_smallScrew(center_x + single * 43 ,center_y - single * 31, side / 46.1538461538, 0);
	// 右上角大螺丝
	draw_RouteTable_bigScrew(center_x + single * 43.5, center_y - single * 25, side / 30, 90);
	// 右下角小螺丝
	draw_RouteTable_smallScrew(center_x + single * 43.5, center_y + single * 28, side / 46.1538461538, 0);

	// 左边小按钮
	draw_RouteTable_Side_Button(center_x - single * 42, center_y - single * 15, side / 13.33333333);
	draw_RouteTable_Side_Button(center_x - single * 42, center_y - single * 8, side / 13.33333333);
	draw_RouteTable_Side_Button(center_x - single * 42, center_y - single * 1, side / 13.33333333);
	draw_RouteTable_Side_Button(center_x - single * 42, center_y + single * 6, side / 13.33333333);
	draw_RouteTable_Side_Button(center_x - single * 42, center_y + single * 13, side / 13.33333333);
	draw_RouteTable_Side_Button(center_x - single * 42, center_y + single * 20, side / 13.33333333);

	setcolor(EGEARGB(100, 124, 124, 128));
	setlinewidth(side / 200);
	ege_line(center_x - single * 38.5, center_y - single * 15, center_x - single * 37, center_y - single * 15);//1
	ege_line(center_x - single * 37, center_y - single * 15, center_x - single * 31.6, center_y - single * 14.6);
	ege_line(center_x - single * 38.5, center_y - single * 8, center_x - single * 37, center_y - single * 8);//2
	ege_line(center_x - single * 37, center_y - single * 8, center_x - single * 31.6, center_y - single * 7.7);
	ege_line(center_x - single * 38.5, center_y - single * 1, center_x - single * 37, center_y - single * 1);//3
	ege_line(center_x - single * 37, center_y - single * 1, center_x - single * 31.6, center_y - single * 0.7);
	ege_line(center_x - single * 38.5, center_y + single * 6, center_x - single * 37, center_y + single * 6);//4
	ege_line(center_x - single * 37, center_y + single * 6, center_x - single * 31.6, center_y + single * 6.3);
	ege_line(center_x - single * 38.5, center_y + single * 13, center_x - single * 37, center_y + single * 13);//5
	ege_line(center_x - single * 37, center_y + single * 13, center_x - single * 31.6, center_y + single * 13.2);
	ege_line(center_x - single * 38.5, center_y + single * 20, center_x - single * 37, center_y + single * 20);//6
	ege_line(center_x - single * 37, center_y + single * 20, center_x - single * 31.6, center_y + single * 20.2);

	// 右边小按钮
	draw_RouteTable_Side_Button(center_x + single * 42, center_y - single * 15, side / 13.33333333);
	draw_RouteTable_Side_Button(center_x + single * 42, center_y - single * 8, side / 13.33333333);
	draw_RouteTable_Side_Button(center_x + single * 42, center_y - single * 1, side / 13.33333333);
	draw_RouteTable_Side_Button(center_x + single * 42, center_y + single * 6, side / 13.33333333);
	draw_RouteTable_Side_Button(center_x + single * 42, center_y + single * 13, side / 13.33333333);
	draw_RouteTable_Side_Button(center_x + single * 42, center_y + single * 20, side / 13.33333333);

	setcolor(EGEARGB(100, 124, 124, 128));
	setlinewidth(side / 200);
	ege_line(center_x + single * 38.5, center_y - single * 15, center_x + single * 37, center_y - single * 15);//1
	ege_line(center_x + single * 37, center_y - single * 15, center_x + single * 31.6, center_y - single * 14.6);
	ege_line(center_x + single * 38.5, center_y - single * 8, center_x + single * 37, center_y - single * 8);//2
	ege_line(center_x + single * 37, center_y - single * 8, center_x + single * 31.6, center_y - single * 7.7);
	ege_line(center_x + single * 38.5, center_y - single * 1, center_x + single * 37, center_y - single * 1);//3
	ege_line(center_x + single * 37, center_y - single * 1, center_x + single * 31.6, center_y - single * 0.7);
	ege_line(center_x + single * 38.5, center_y + single * 6, center_x + single * 37, center_y + single * 6);//4
	ege_line(center_x + single * 37, center_y + single * 6, center_x + single * 31.6, center_y + single * 6.3);
	ege_line(center_x + single * 38.5, center_y + single * 13, center_x + single * 37, center_y + single * 13);//5
	ege_line(center_x + single * 37, center_y + single * 13, center_x + single * 31.6, center_y + single * 13.2);
	ege_line(center_x + single * 38.5, center_y + single * 20, center_x + single * 37, center_y + single * 20);//6
	ege_line(center_x + single * 37, center_y + single * 20, center_x + single * 31.6, center_y + single * 20.2);
}

// 下半部分的表
void draw_RouteTable_down(double center_x, double center_y, double side) {//side传的是竖高
	draw_RouteTable_down2(center_x,center_y,side);
	draw_RouteTable_down1(center_x , center_y - side / 3.5, side);
}

// 表上的十字旋钮
void draw_RouteTable_smallScrew(double screw_x, double screw_y, double screw_r,double angle) {

	setfillcolor(EGEARGB(0XFF, 0X1A, 0X1F, 0X23));
	ege_fillellipse(screw_x - screw_r, screw_y - screw_r, 2 * screw_r, 2 * screw_r);

	setcolor(BLACK);
	setlinewidth(screw_r/7.5);
	ege_ellipse(screw_x - screw_r, screw_y - screw_r, 2 * screw_r, 2 * screw_r);

	// 绘制中间螺丝
	angle = -angle;
	angle = angle * PI / 180;

	double x01 = -screw_r * 0.7, y01 = -screw_r * 0.15;
	double x02 = -screw_r * 0.7, y02 = +screw_r * 0.15;
	double x03 = +screw_r * 0.7, y03 = +screw_r * 0.15;
	double x04 = +screw_r * 0.7, y04 = -screw_r * 0.15;

	setfillcolor(BLACK);
	ege_point polypoints1[4] = {
		{x01 * cos(angle) - y01 * sin(angle) + screw_x,x01 * sin(angle) + y01 * cos(angle) + screw_y},// 左上
		{x02 * cos(angle) - y02 * sin(angle) + screw_x,x02 * sin(angle) + y02 * cos(angle) + screw_y},// 右上
		{x03 * cos(angle) - y03 * sin(angle) + screw_x,x03 * sin(angle) + y03 * cos(angle) + screw_y},// 右下
		{x04 * cos(angle) - y04 * sin(angle) + screw_x,x04 * sin(angle) + y04 * cos(angle) + screw_y} // 左下
	};
	ege_fillpoly(4, polypoints1);


	double x11 = -screw_r * 0.15, y11 = -screw_r * 0.7;
	double x12 = -screw_r * 0.15, y12 = +screw_r * 0.7;
	double x13 = +screw_r * 0.15, y13 = +screw_r * 0.7;
	double x14 = +screw_r * 0.15, y14 = -screw_r * 0.7;

	ege_point polypoints2[4] = {
		{x11 * cos(angle) - y11 * sin(angle) + screw_x,x11 * sin(angle) + y11 * cos(angle) + screw_y},// 左上
		{x12 * cos(angle) - y12 * sin(angle) + screw_x,x12 * sin(angle) + y12 * cos(angle) + screw_y},// 右上
		{x13 * cos(angle) - y13 * sin(angle) + screw_x,x13 * sin(angle) + y13 * cos(angle) + screw_y},// 右下
		{x14 * cos(angle) - y14 * sin(angle) + screw_x,x14 * sin(angle) + y14 * cos(angle) + screw_y} // 左下
	};
	ege_fillpoly(4, polypoints2);


	// 螺丝中间菱形
	double x21 = -screw_r * 0.4, y21 = 0;
	double x22 = 0, y22 = +screw_r * 0.4;
	double x23 = +screw_r * 0.4, y23 = 0;
	double x24 = 0, y24 = -screw_r * 0.4;
	setcolor(BLACK);
	setfillcolor(BLACK);
	ege_point polypoints5[5] = {
		{x21 * cos(angle) - y21 * sin(angle) + screw_x,x21 * sin(angle) + y21 * cos(angle) + screw_y},// 上
		{x22 * cos(angle) - y22 * sin(angle) + screw_x,x22 * sin(angle) + y22 * cos(angle) + screw_y},// 右
		{x23 * cos(angle) - y23 * sin(angle) + screw_x,x23 * sin(angle) + y23 * cos(angle) + screw_y},// 下
		{x24 * cos(angle) - y24 * sin(angle) + screw_x,x24 * sin(angle) + y24 * cos(angle) + screw_y},//左
		{x21 * cos(angle) - y21 * sin(angle) + screw_x,x21 * sin(angle) + y21 * cos(angle) + screw_y}
	};
	ege_fillpoly(5, polypoints5);

	
}

// 表上的一字旋钮
void draw_RouteTable_bigScrew(double screw_x, double screw_y, double screw_r, double angle) {

	setfillcolor(EGEARGB(0XFF, 0X1A, 0X1F, 0X23));
	ege_fillellipse(screw_x - screw_r, screw_y - screw_r, 2 * screw_r, 2 * screw_r);

	setcolor(BLACK);
	setlinewidth(screw_r / 7.5);
	ege_ellipse(screw_x - screw_r, screw_y - screw_r, 2 * screw_r, 2 * screw_r);

	// 绘制中间螺丝
	angle = -angle;
	angle = angle * PI / 180;

	double x01 = -screw_r * 1, y01 = -screw_r * 0.15;
	double x02 = -screw_r * 1, y02 = +screw_r * 0.15;
	double x03 = +screw_r * 1, y03 = +screw_r * 0.15;
	double x04 = +screw_r * 1, y04 = -screw_r * 0.15;

	setfillcolor(BLACK);
	ege_point polypoints1[4] = {
		{x01 * cos(angle) - y01 * sin(angle) + screw_x,x01 * sin(angle) + y01 * cos(angle) + screw_y},// 左上
		{x02 * cos(angle) - y02 * sin(angle) + screw_x,x02 * sin(angle) + y02 * cos(angle) + screw_y},// 右上
		{x03 * cos(angle) - y03 * sin(angle) + screw_x,x03 * sin(angle) + y03 * cos(angle) + screw_y},// 右下
		{x04 * cos(angle) - y04 * sin(angle) + screw_x,x04 * sin(angle) + y04 * cos(angle) + screw_y} // 左下
	};
	ege_fillpoly(4, polypoints1);

}

// 表上的一字旋钮——靠下的
void draw_RouteTable_bigScrew2(double screw_x, double screw_y, double screw_r, double angle) {

	setfillcolor(EGEARGB(0XFF, 0X1A, 0X1F, 0X23));
	ege_fillellipse(screw_x - screw_r, screw_y - screw_r, 2 * screw_r, 2 * screw_r);

	setcolor(BLACK);
	setlinewidth(screw_r / 7.5);
	ege_ellipse(screw_x - screw_r/1.2, screw_y - screw_r/1.2, 1.6 * screw_r, 1.6 * screw_r);

	// 绘制中间螺丝
	angle = -angle;
	angle = angle * PI / 180;

	double x01 = -screw_r * 0.8, y01 = -screw_r * 0.15;
	double x02 = -screw_r * 0.8, y02 = +screw_r * 0.15;
	double x03 = +screw_r * 0.8, y03 = +screw_r * 0.15;
	double x04 = +screw_r * 0.8, y04 = -screw_r * 0.15;

	setfillcolor(BLACK);
	ege_point polypoints1[4] = {
		{x01 * cos(angle) - y01 * sin(angle) + screw_x,x01 * sin(angle) + y01 * cos(angle) + screw_y},// 左上
		{x02 * cos(angle) - y02 * sin(angle) + screw_x,x02 * sin(angle) + y02 * cos(angle) + screw_y},// 右上
		{x03 * cos(angle) - y03 * sin(angle) + screw_x,x03 * sin(angle) + y03 * cos(angle) + screw_y},// 右下
		{x04 * cos(angle) - y04 * sin(angle) + screw_x,x04 * sin(angle) + y04 * cos(angle) + screw_y} // 左下
	};
	ege_fillpoly(4, polypoints1);

}

// 上半部分旁边的按钮
void draw_RouteTable_Side_Button(double center_x,double center_y,double side) {
	setfillcolor(BLACK);
	double single = side / 4.5;
	double width = single * 4.5;
	double length = single * 6;
	ege_fillrect(center_x - length / 2, center_y - width / 2, length, width);

	setcolor(EGEARGB(0xff, 136, 97, 67));//橙色
	setlinewidth(side / 7.5);
	ege_line(center_x - single * 2, center_y, center_x + single * 2, center_y);
}

// 下半部分的最上一层
void draw_RouteTable_down1(double center_x, double center_y, double side) {

	// 这里的center是这个表盘部件的中心
	double single = side / 67;

	setfillcolor(EGEARGB(0XFF, 0X15, 0X1A, 0X1D));
	setcolor(EGEARGB(0XFF, 0X15, 0X1A, 0X1D));
	ege_point points1[14] = {
		center_x - single * 34,center_y - single * 19,//1点
		center_x - single * 38,center_y - single * 15,//2点
		center_x - single * 38,center_y + single * 15,//3点
		center_x - single * 34,center_y + single * 19,//4点
		center_x - single * 16,center_y + single * 19,//5点
		center_x - single * 12,center_y + single * 15,//6点
		center_x - single * 12,center_y + single * 5,//7点
		center_x - single * 11,center_y + single * 2,//8点
		center_x - single * 8,center_y + single * 1,//9点
		center_x + single * 34,center_y + single * 1,//10点
		center_x + single * 38,center_y - single * 3,//11点
		center_x + single * 38,center_y - single * 15,//12点
		center_x + single * 34,center_y - single * 19,//13点
		center_x - single * 34,center_y - single * 19//1点
	};
	ege_fillpoly(14, points1);
	ege_drawpoly(14,points1);
 
	// 这是对这块部分的四周的圆滑处理
	ege_fillellipse(center_x - single * 38.4, center_y - single *19.4,single * 7.4,single *7.4);
	ege_fillellipse(center_x - single * 38.2, center_y + single * 12, single * 7, single * 7);
	ege_fillellipse(center_x - single * 19, center_y + single * 12, single * 7, single * 7);
	ege_fillellipse(center_x + single * 31.4, center_y - single * 19.4, single * 7, single * 7);//右上
	ege_fillellipse(center_x + single * 31.2, center_y - single * 6, single * 7, single * 7);//右下
	setlinewidth(6);
	ege_point points2[4] = {
		center_x - single * 12.5,center_y + single * 5.5,//7点
		center_x - single * 11,center_y + single * 2,//
		center_x - single * 11,center_y + single * 2,//
		center_x - single * 7,center_y + single * 0.5//9点
	};
	ege_bezier(4,points2);

	// 下面的坐标的坐标系是以右为x的正半轴，下为y的正半轴
	draw_RouteTable_down1_button(center_x - single * 31,center_y - single * 13.5,single * 70);//(1,1)
	draw_RouteTable_down1_button(center_x - single * 31, center_y - single * 4.9, single * 70);//(1,2)
	draw_RouteTable_down1_button(center_x - single * 31, center_y + single * 3.7, single * 70);//(1,3)
	draw_RouteTable_down1_button(center_x - single * 31, center_y + single * 12.3, single * 70);//(1,4)
	draw_RouteTable_down1_button(center_x - single * 19, center_y - single * 13.5, single * 70);//(2,1)
	draw_RouteTable_down1_button(center_x - single * 19, center_y - single * 4.9, single * 70);//(2,2)
	draw_RouteTable_down1_button(center_x - single * 19, center_y + single * 3.7, single * 70);//(2,3)
	draw_RouteTable_down1_button(center_x - single * 19, center_y + single * 12.3, single * 70);//(2,4)
	draw_RouteTable_down1_button(center_x - single * 7, center_y - single * 13.5, single * 70);//(3,1)
	draw_RouteTable_down1_button(center_x - single * 7, center_y - single * 4.9, single * 70);//(3,2)
	draw_RouteTable_down1_button(center_x + single * 5, center_y - single * 13.5, single * 70);//(4,1)
	draw_RouteTable_down1_button(center_x + single * 5, center_y - single * 4.9, single * 70);//(4,2)
	draw_RouteTable_down1_button(center_x + single * 17, center_y - single * 13.5, single * 70);//(5,1)
	draw_RouteTable_down1_button(center_x + single * 17, center_y - single * 4.9, single * 70);//(5,2)
	setfillcolor(BLACK);
	ege_fillrect(center_x + single * 26, center_y - single * 6.5, single * 10, single * 5);//最右
	ege_fillrect(center_x + single * 28, center_y - single * 9, single * 6, single);
	ege_fillellipse(center_x + single * 31, center_y - single * 16, single * 4, single * 4);

	setbkmode(TRANSPARENT);
	settextjustify(CENTER_TEXT, CENTER_TEXT);
	setfont(single * 3, 0, "黑体");
	setcolor(EGEARGB(0xff, 136, 97, 67));
	ege_drawtext("INIT", center_x - single * 31, center_y - single * 14.2);//(1,1) 移0.7 移1.5
	ege_drawtext("REF", center_x - single * 31, center_y - single * 12);//
	ege_drawtext("DIR", center_x - single * 31, center_y - single * 5.6);//(1,2)
	ege_drawtext("INTC", center_x - single * 31, center_y - single * 3.4);
	ege_drawtext("FIX", center_x - single * 31, center_y + single * 3.8);//(1.3)
	ege_drawtext("PREV", center_x - single * 31, center_y + single * 11.6);//(1,4)
	ege_drawtext("PAGE", center_x - single * 31, center_y + single * 13.8);
	ege_drawtext("RTE", center_x - single * 19, center_y - single * 13.4);//(2,1)
	ege_drawtext("LEGS", center_x - single * 19, center_y - single * 4.8);//(2,2)
	ege_drawtext("NAV",center_x - single * 19, center_y + single * 3);//(2,3)
	ege_drawtext("RAD", center_x - single * 19, center_y + single * 5.2);
	ege_drawtext("NEXT", center_x - single * 19, center_y + single * 11.6);//(2,4)
	ege_drawtext("PAGE", center_x - single * 19, center_y + single * 13.8);
	ege_drawtext("CLB", center_x - single * 7, center_y - single * 13.4);//(3,1)
	ege_drawtext("DEP", center_x - single * 7, center_y - single * 5.5);//(3,2)
	ege_drawtext("ARR", center_x - single * 7, center_y - single * 3.4);
	ege_drawtext("CRZ", center_x + single * 5, center_y - single * 13.4);//(4,1)
	ege_drawtext("HOLD", center_x + single * 5, center_y - single * 4.8);//(4,2)
	ege_drawtext("DES", center_x + single * 17, center_y - single * 13.4);//(5,1)
	ege_drawtext("PROG", center_x + single * 17, center_y - single * 4.8);//(5,2)
	ege_drawtext("EXEC", center_x + single * 31, center_y - single * 3.8);
	setfont(single * 2.5, 0, "黑体");
	ege_drawtext("B", center_x + single * 25, center_y - single * 17);
	ege_drawtext("R", center_x + single * 25, center_y - single * 15);
	ege_drawtext("T", center_x + single * 25, center_y - single * 13);



}

// 下半部分的最上一层的按钮
void draw_RouteTable_down1_button(double center_x, double center_y, double side) {

	double single = side / 67;
	double length = single * 10;
	double width = single * 7;

	setfillcolor(BLACK);
	ege_fillrect(center_x - length / 2, center_y - width / 2, length, width);

}

// 下半部分的最下一层
void draw_RouteTable_down2(double center_x, double center_y, double side){

	double single = side / 67;

	setfillcolor(EGEARGB(0XFF, 0X15, 0X1A, 0X1D));
	ege_fillrect(center_x - single * 46, center_y + single * 28, single * 92, single * 10);

	setfillcolor(EGEARGB(0XFF, 0X1A, 0X1F, 0X23));
	setcolor(EGEARGB(0XFF, 0X1A, 0X1F, 0X23));

	ege_point points1[25] = {//40,38.5
		center_x - single * 37, center_y - single * 38.5,//1
		center_x - single * 40,center_y - single * 35.5,//2
		center_x - single * 40,center_y - single * 17.5,//3
		center_x - single * 40.5,center_y - single * 15,//4
		center_x - single * 42,center_y - single * 14.5,//5
		center_x - single * 44,center_y - single * 12.5,//6
		center_x - single * 44,center_y + single * 22.5,//7
		center_x - single * 43,center_y + single * 23.5,//8
		center_x - single * 41,center_y + single * 26.5,//9
		center_x - single * 40,center_y + single * 28.5,//10
		center_x - single * 40,center_y + single * 36.5,//11
		center_x - single * 38,center_y + single * 38.5,//12

		center_x + single * 38,center_y + single * 38.5,//13
		center_x + single * 40,center_y + single * 36.5,//14
		center_x + single * 40,center_y + single * 28.5,//15
		center_x + single * 41,center_y + single * 26.5,//16
		center_x + single * 43,center_y + single * 23.5,//17
		center_x + single * 44,center_y + single * 22.5,//18
		center_x + single * 44,center_y - single * 12.5,//19
		center_x + single * 42,center_y - single * 14.5,//20
		center_x + single * 40.5,center_y - single * 15,//21
		center_x + single * 40,center_y - single * 17.5,//22
		center_x + single * 40,center_y - single * 35.5,//23
		center_x + single * 37, center_y - single * 38.5,//24

		center_x - single * 37, center_y - single * 38.5//1
	};
	ege_fillpoly(25, points1);
	ege_drawpoly(25, points1);

	// 这是对这块部分的四周的圆滑处理
	ege_fillellipse(center_x - single * 40, center_y - single * 38.5,single * 5.2,single * 5.2);//左上角圆
	ege_fillellipse(center_x + single * 35, center_y - single * 38.5, single * 5, single * 5);//左上角圆
	ege_fillellipse(center_x - single * 44, center_y - single * 14.5, single * 3.5, single * 3.5);//左中间圆偏上
	ege_fillellipse(center_x + single * 40.5, center_y - single * 14.5, single * 3.5, single * 3.5);//右中间圆偏上
	ege_fillellipse(center_x - single * 44.1, center_y + single * 15, single * 5, single * 5);//左中间圆偏下
	ege_fillellipse(center_x + single * 39.1, center_y + single * 15, single * 5, single * 5);//右中间圆偏下
	ege_fillellipse(center_x - single * 40, center_y + single * 35, single * 3.5, single * 3.5);//左下角圆
	ege_fillellipse(center_x + single * 36.5, center_y + single * 35, single * 3.5, single * 3.5);//右下角圆
	setlinewidth(side / 75);
	ege_point points2[4] = {// 左中弧线
		center_x - single * 39,center_y - single * 18,//3
		center_x - single * 40.5,center_y - single * 15,//4
		center_x - single * 40.5,center_y - single * 15,//4
		center_x - single * 43,center_y - single * 14//5
	};
	ege_bezier(4, points2);
	ege_point points3[4] = {//右中弧线
		center_x + single * 39,center_y - single * 18,//3
		center_x + single * 40.5,center_y - single * 15,//4
		center_x + single * 40.5,center_y - single * 15,//4
		center_x + single * 43,center_y - single * 14//5
	};
	ege_bezier(4, points3);

	draw_RouteTable_down2_circle(center_x - single * 33.7,center_y + single * 5,single * 3.6);//(1,1)
	draw_RouteTable_down2_circle(center_x - single * 33.7, center_y + single * 14, single * 3.6);//(1,2)
	draw_RouteTable_down2_circle(center_x - single * 33.7, center_y + single * 23, single * 3.6);//(1,3)
	draw_RouteTable_down2_circle(center_x - single * 33.7, center_y + single * 32, single * 3.6);//(1,4)
	draw_RouteTable_down2_circle(center_x - single * 24.6, center_y + single * 5, single * 3.6);//(2,1)
	draw_RouteTable_down2_circle(center_x - single * 24.6, center_y + single * 14, single * 3.6);//(2,2)
	draw_RouteTable_down2_circle(center_x - single * 24.6, center_y + single * 23, single * 3.6);//(2,3)
	draw_RouteTable_down2_circle(center_x - single * 24.6, center_y + single * 32, single * 3.6);//(2,4)
	draw_RouteTable_down2_circle(center_x - single * 15.5, center_y + single * 5, single * 3.6);//(3,1)
	draw_RouteTable_down2_circle(center_x - single * 15.5, center_y + single * 14, single * 3.6);//(3,2)
	draw_RouteTable_down2_circle(center_x - single * 15.5, center_y + single * 23, single * 3.6);//(3,3)
	draw_RouteTable_down2_circle(center_x - single * 15.5, center_y + single * 32, single * 3.6);//(3,4)

	setbkmode(TRANSPARENT);
	settextjustify(CENTER_TEXT, CENTER_TEXT);
	setfont(single * 5, 0, "黑体");
	setcolor(EGEARGB(0xff, 136, 97, 67));
	ege_drawtext("1", center_x - single * 33.5, center_y + single * 5.1);
	ege_drawtext("4", center_x - single * 33.6, center_y + single * 14.2);
	ege_drawtext("7", center_x - single * 33.6, center_y + single * 23.2);
	ege_drawtext(".", center_x - single * 33.1, center_y + single * 30.8);
	ege_drawtext("2", center_x - single * 24.4, center_y + single * 5.1);
	ege_drawtext("5", center_x - single * 24.4, center_y + single * 14.2);
	ege_drawtext("8", center_x - single * 24.4, center_y + single * 23.2);
	ege_drawtext("0", center_x - single * 24.4, center_y + single * 32.2);
	ege_drawtext("3", center_x - single * 15.3, center_y + single * 5.1);
	ege_drawtext("6", center_x - single * 15.3, center_y + single * 14.2);
	ege_drawtext("9", center_x - single * 15.3, center_y + single * 23.2);
	setfont(single * 4, 0, "黑体");
	ege_drawtext("+", center_x - single * 16.3, center_y + single * 31.5);
	ege_drawtext("/", center_x - single * 15, center_y + single * 32.4);
	ege_drawtext("-", center_x - single * 14, center_y + single * 33.4);

	draw_RouteTable_down2_square(center_x - single * 4.8, center_y - single * 13,single * 7);//(1,1)
	draw_RouteTable_down2_square(center_x - single * 4.8, center_y - single * 4.1, single * 7);//(1,2)
	draw_RouteTable_down2_square(center_x - single * 4.8, center_y + single * 4.7, single * 7);//(1,3)
	draw_RouteTable_down2_square(center_x - single * 4.8, center_y + single * 14,single *7);//(1,4)
	draw_RouteTable_down2_square(center_x - single * 4.8, center_y + single * 23, single * 7);//(1,5)
	draw_RouteTable_down2_square(center_x - single * 4.8, center_y + single * 32, single * 7);//(1,6)
	draw_RouteTable_down2_square(center_x + single * 5.2, center_y - single * 13, single * 7);//(2,1)
	draw_RouteTable_down2_square(center_x + single * 5.2, center_y - single * 4.1, single * 7);//(2,2)
	draw_RouteTable_down2_square(center_x + single * 5.2, center_y + single * 4.7, single * 7);//(2,3)
	draw_RouteTable_down2_square(center_x + single * 5.2, center_y + single * 14, single * 7);//(2,4)
	draw_RouteTable_down2_square(center_x + single * 5.2, center_y + single * 23, single * 7);//(2,5)
	draw_RouteTable_down2_square(center_x + single * 5.2, center_y + single * 32, single * 7);//(2,6)
	draw_RouteTable_down2_square(center_x + single * 15.2, center_y - single * 13, single * 7);//(3,1)
	draw_RouteTable_down2_square(center_x + single * 15.2, center_y - single * 4.1, single * 7);//(3,2)
	draw_RouteTable_down2_square(center_x + single * 15.2, center_y + single * 4.7, single * 7);//(3,3)
	draw_RouteTable_down2_square(center_x + single * 15.2, center_y + single * 14, single * 7);//(3,4)
	draw_RouteTable_down2_square(center_x + single * 15.2, center_y + single * 23, single * 7);//(3,5)
	draw_RouteTable_down2_square(center_x + single * 15.2, center_y + single * 32, single * 7);//(3,6)
	draw_RouteTable_down2_square(center_x + single * 24.8, center_y - single * 13, single * 7);//(4,1)
	draw_RouteTable_down2_square(center_x + single * 24.8, center_y - single * 4.1, single * 7);//(4,2)
	draw_RouteTable_down2_square(center_x + single * 24.8, center_y + single * 4.7, single * 7);//(4,3)
	draw_RouteTable_down2_square(center_x + single * 24.8, center_y + single * 14, single * 7);//(4,4)
	draw_RouteTable_down2_square(center_x + single * 24.8, center_y + single * 23, single * 7);//(4,5)
	draw_RouteTable_down2_square(center_x + single * 24.8, center_y + single * 32, single * 7);//(4,6)
	draw_RouteTable_down2_square(center_x + single * 34.4, center_y - single * 13, single * 7);//(5,1)
	draw_RouteTable_down2_square(center_x + single * 34.4, center_y - single * 4.1, single * 7);//(5,2)
	draw_RouteTable_down2_square(center_x + single * 34.4, center_y + single * 4.7, single * 7);//(5,3)
	draw_RouteTable_down2_square(center_x + single * 34.4, center_y + single * 14, single * 7);//(5,4)
	draw_RouteTable_down2_square(center_x + single * 34.4, center_y + single * 23, single * 7);//(5,5)
	draw_RouteTable_down2_square(center_x + single * 34.4, center_y + single * 32, single * 7);//(5,6)

	setbkmode(TRANSPARENT);
	settextjustify(CENTER_TEXT, CENTER_TEXT);
	setfont(single * 5, 0, "黑体");
	setcolor(EGEARGB(0xff, 136, 97, 67));
	ege_drawtext("A", center_x - single * 4.8, center_y - single * 12.9);
	ege_drawtext("F", center_x - single * 4.8, center_y - single * 4);
	ege_drawtext("K", center_x - single * 4.8, center_y + single * 4.8);
	ege_drawtext("P", center_x - single * 4.8, center_y + single * 14.1);
	ege_drawtext("U", center_x - single * 4.8, center_y + single * 23.1);
	ege_drawtext("Z", center_x - single * 4.8, center_y + single * 32.1);
	ege_drawtext("B", center_x + single * 5.2, center_y - single * 12.9);
	ege_drawtext("G", center_x + single * 5.2, center_y - single * 4);
	ege_drawtext("L", center_x + single * 5.2, center_y + single * 4.8);
	ege_drawtext("Q", center_x + single * 5.2, center_y + single * 14.1);
	ege_drawtext("V", center_x + single * 5.2, center_y + single * 23.1);
	ege_drawtext("", center_x + single * 5.2, center_y + single * 32.1);
	ege_drawtext("C", center_x + single * 15.2, center_y - single * 12.9);
	ege_drawtext("H", center_x + single * 15.2, center_y - single * 4);
	ege_drawtext("M", center_x + single * 15.2, center_y + single * 4.8);
	ege_drawtext("R", center_x + single * 15.2, center_y + single * 14.1);
	ege_drawtext("W", center_x + single * 15.2, center_y + single * 23.1);
	setfont(single * 3, 0, "黑体");
	ege_drawtext("DEL", center_x + single * 15.2, center_y + single * 32.1);
	setfont(single * 5, 0, "黑体");
	ege_drawtext("D", center_x + single * 24.8, center_y - single * 12.9);
	ege_drawtext("I", center_x + single * 24.8, center_y - single * 4);
	ege_drawtext("N", center_x + single * 24.8, center_y + single * 4.8);
	ege_drawtext("S", center_x + single * 24.8, center_y + single * 14.1);
	ege_drawtext("X", center_x + single * 24.8, center_y + single * 23.1);
	ege_drawtext("/", center_x + single * 24.8, center_y + single * 32.1);
	ege_drawtext("E", center_x + single * 34.4, center_y - single * 12.9);
	ege_drawtext("J", center_x + single * 34.4, center_y - single * 4);
	ege_drawtext("O", center_x + single * 34.4, center_y + single * 4.8);
	ege_drawtext("T", center_x + single * 34.4, center_y + single * 14.1);
	ege_drawtext("Y", center_x + single * 34.4, center_y + single * 23.1);
	setfont(single * 3, 0, "黑体");
	ege_drawtext("CLR", center_x + single * 34.4, center_y + single * 32.1);
	draw_RouteTable_down2_square_poly(center_x + single * 15.2, center_y + single * 23,single *2.5);
	draw_RouteTable_down2_square_poly(center_x + single * 24.8, center_y + single * 4.7, single * 2.5);
	draw_RouteTable_down2_square_poly(center_x + single * 24.8, center_y + single * 14, single * 2.5);
	draw_RouteTable_down2_square_poly(center_x + single * 34.4, center_y - single * 13, single * 2.5);

	setfillcolor(EGEARGB(0xff,25,22,12));
	ege_fillellipse(center_x - single * 42.5,center_y - single * 13,single * 3,single *3);
	ege_fillellipse(center_x + single * 40, center_y - single * 13, single * 3, single * 3);
	setfillcolor(BLACK);
	ege_fillellipse(center_x - single * 42.5, center_y + single * 19, single * 3, single * 3);
	ege_fillellipse(center_x + single * 40, center_y + single * 19, single * 3, single * 3);
	ege_fillrect(center_x - single * 42.2, center_y - single * 8,single*2.5,single * 24);
	ege_fillrect(center_x + single * 40, center_y - single * 8, single * 2.5, single * 24);

	setcolor(EGEARGB(50, 177, 177, 179));
	setfont(single * 2.5, 0, "黑体");
	ege_drawtext("D",center_x - single * 41, center_y - single * 6);
	ege_drawtext("S", center_x - single * 41, center_y - single * 3.5);
	ege_drawtext("P", center_x - single * 41, center_y - single * 1);
	ege_drawtext("Y", center_x - single * 41, center_y + single * 1.5);

	ege_drawtext("F", center_x - single * 41, center_y + single * 6);
	ege_drawtext("A", center_x - single * 41, center_y + single * 8.5);
	ege_drawtext("I", center_x - single * 41, center_y + single * 11);
	ege_drawtext("L", center_x - single * 41, center_y + single * 13.5);

	ege_drawtext("M", center_x + single * 41.4, center_y - single * 5);
	ege_drawtext("S", center_x + single * 41.4, center_y - single * 2.5);
	ege_drawtext("G", center_x + single * 41.4, center_y );

	ege_drawtext("O", center_x + single * 41.4, center_y + single * 5);
	ege_drawtext("F", center_x + single * 41.4, center_y + single * 7.5);
	ege_drawtext("S", center_x + single * 41.4, center_y + single * 10);
	ege_drawtext("T", center_x + single * 41.4, center_y + single * 12.5);

	setfillcolor(EGEARGB(0XFF, 0X1A, 0X1F, 0X23));
	double left_x = center_x - single * 46.5, left_y = center_y - single * 31;
	ege_point points4[7] = {
		left_x,left_y,//1
		left_x,left_y+ single *3,//2
		left_x + single * 2.4,left_y + single * 3,//3
		left_x + single * 2.4,left_y + single * 14,//4
		left_x + single * 6,left_y + single * 14,//5
		left_x + single * 6,left_y,//6
		left_x,left_y
	};
	ege_fillpoly(7, points4);
	
	double right_x  = center_x + single * 46.5, right_y = center_y - single * 31;
	ege_point points5[7] = {
		right_x, right_y,//1
		right_x, right_y + single * 3,//2
		right_x - single * 2.4, right_y + single * 3,//3
		right_x - single * 2.4, right_y + single * 14,//4
		right_x - single * 6, right_y + single * 14,//5
		right_x - single * 6, right_y,//6
		right_x, right_y
	};
	ege_fillpoly(7, points5);

	draw_RouteTable_bigScrew2(center_x - single * 43.4, center_y - single * 34,single * 2.5, 90);
	draw_RouteTable_bigScrew2(center_x + single * 43.4, center_y - single * 34, single * 2.5, 90);

	setfillcolor(EGEARGB(0XFF, 0X1A, 0X1F, 0X23));
	ege_fillrect(center_x - single * 46, center_y - single * 26, single * 1.6, single * 48);
	ege_fillrect(center_x + single * 44.5, center_y - single * 26, single * 1.6, single * 48);

	draw_RouteTable_bigScrew2(center_x - single * 43.8, center_y + single * 28, single * 3, 90);
	draw_RouteTable_bigScrew2(center_x + single * 43.8, center_y + single * 28, single * 3, 90);
}

// 下半部分的最下一层的圆形
void draw_RouteTable_down2_circle(double center_x, double center_y, double side) {
	setfillcolor(BLACK);
	ege_fillellipse(center_x - side,center_y - side,side * 2,side * 2);
}

// 下半部分的最下一层的正方形
void draw_RouteTable_down2_square(double center_x, double center_y, double side) {
	setfillcolor(BLACK);
	ege_fillrect(center_x - side / 2, center_y - side / 2,side ,side );
}

// 下半部分的最下一层的正方形中间的线框
void draw_RouteTable_down2_square_poly(double center_x, double center_y, double side) {
	setlinewidth(side / 11.1940298);
	setcolor(EGEARGB(0xff, 136, 97, 67));
	ege_point points[5] = {
		center_x - side,center_y - side,
		center_x - side,center_y + side,
		center_x + side,center_y + side,
		center_x + side,center_y - side,
		center_x - side,center_y - side
	};
	ege_drawpoly(5, points);
}